import http from '@/utils/request'

const API_PREFIX = `${process.env.VUE_APP_SQL_AGENT_PREFIX}sql`

export const checkSql = params => {
  return http.post(`${API_PREFIX}/sql-agent/checkSql`, params)
}

export const fetchSqlResult = params =>
  http.get(`${API_PREFIX}/sql-agent/getSqlResult`, { params })

export const fetchMachines = params =>
  http.get(`${API_PREFIX}/sql-agent/getMachine`, {
    params
  })

export const testConnect = params =>
  http.post(`${API_PREFIX}/sql-agent/testConnect`, params)

export const fetchDatasets = params =>
  http.get(`${API_PREFIX}/sql-agent/getDataset`, { params })

export const agentActive = ({id,...params}) =>
  http.get(`${API_PREFIX}/sql-agent/active/${id}`, { params })
